{% extends "base_generic.html" %}

{% block content %}

<h1>Language: {{ language.name }}</h1>

<div style="margin-left:20px;margin-top:20px">
<h4>Books in language</h4>

<ul>
  {% for copy in language.book_set.all %}
  <li>
    <a href="{{ copy.get_absolute_url }}">{{ copy.title }}</a>
  </li>
  {% empty %}
  <li>There are no books in this language.</li>
  {% endfor %}
</ul>

{% endblock %}


{% block sidebar %}
  {{ block.super }}

  {% if perms.catalog.change_language or perms.catalog.delete_language %}
  <hr>
  <ul class="sidebar-nav">
    {% if perms.catalog.change_language %}
      <li><a href="{% url 'language-update' language.id %}">Update Language</a></li>
    {% endif %}
    {% if not language.book_set.all and perms.catalog.delete_language %}
      <li><a href="{% url 'language-delete' language.id %}">Delete Language</a></li>
    {% endif %}
    </ul>
  {% endif %}

{% endblock %}
